package com.gopay.common.asynexport.util;


import com.gopay.common.constants.approval.DecisionValue;
import com.gopay.common.constants.cbrmb.CbRmbOrderState;
import com.gopay.common.constants.cps.PayStat;
import com.gopay.common.constants.cust.CustCorpInfoConstants;
import com.gopay.common.constants.cust.CustPersonInfoConstants;
import com.gopay.common.constants.order.OrderAdjustRecordStatus;
import com.gopay.common.constants.trans.*;
import com.gopay.common.domain.acps.AcctProd;
import com.gopay.common.domain.acps.AcctStatus;
import org.apache.commons.lang.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 翻译部分字典值，便于页面显示
 *
 * @DicTranslate.java
 * @author HJY @2013-3-13 上午09:31:43 www.gopay.com.cn Inc.All rights reserved.
 */
public class DicTranslate {

    private static Map<String, String> intTxnCdMap = new HashMap<String, String>();
    private static Map<String, String> custTypeMap = new HashMap<String, String>();

    static {
        /** 通用支付 */
        intTxnCdMap.put("00100", "网关支付");
        /** 大宗入金 */
        intTxnCdMap.put("00200", "入金");
        /** 大宗划拨收益 */
        intTxnCdMap.put("00201", "划拨收益");
        /** 大宗出金 */
        intTxnCdMap.put("00202", "出金");
        /** 大宗签约 */
        intTxnCdMap.put("00203", "签约");
        /** 大宗解约 */
        intTxnCdMap.put("00204", "解约");
        /** 大宗签到 */
        intTxnCdMap.put("00205", "大宗签到");
        /** 大宗签退 */
        intTxnCdMap.put("00206", "大宗签退");
        /** 大宗市场入金 */
        intTxnCdMap.put("00207", "大宗市场入金");

        /** 海外购物支付 */
        intTxnCdMap.put("00300", "海外购物支付");
        /** 海外购物退款 */
        intTxnCdMap.put("00301", "海外购物退款");
        /** 海外购物支付确认 */
        intTxnCdMap.put("00302", "海外购物支付确认");

        /** 通用担保支付申请 */
        intTxnCdMap.put("00400", "担保支付申请");
        /** 通用担保支付（部分）完成 */
        intTxnCdMap.put("00401", "担保支付完成");
        /** 通用担保支付取消 */
        intTxnCdMap.put("00402", "担保支付取消");

        /** 虚拟账户充值 */
        intTxnCdMap.put("00500", "充值");

        /** 代扣服务费 */
        intTxnCdMap.put("00600", "代扣");

        /** 付款到银行 */
        intTxnCdMap.put("00700", "付款到银行");

        /** 退款转账 */
        intTxnCdMap.put("00701", "退款转账");

        /** 提现 */
        intTxnCdMap.put("00800", "提现");

        /** 付款到国付宝 */
        intTxnCdMap.put("00900", "付款到国付宝");

        /** 付款到关联账户 */
        intTxnCdMap.put("00901", "内部账户资金划转");

        /** 虚拟账户担保转账申请 */
        intTxnCdMap.put("01000", "虚拟账户担保转账申请");
        /** 虚拟账户担保转账完成 */
        intTxnCdMap.put("01001", "虚拟账户担保转账完成");
        /** 虚拟账户担保转账取消 */
        intTxnCdMap.put("01002", "虚拟账户担保转账取消");

        /** 锁定保证金 */
        intTxnCdMap.put("01100", "锁定保证金");
        /** 解锁保证金 */
        intTxnCdMap.put("01101", "解锁保证金");

        /** 收款交易退款 */
        intTxnCdMap.put("01200", "退款");
        /** 航空票务收款退款 */
        intTxnCdMap.put("01203", "收款退款");
        /** 付款交易退款 */
        intTxnCdMap.put("01201", "付款交易退款");
        /** 分账退款 **/
        intTxnCdMap.put("01202", "收款分账退款");

        /** 错账长款调账 */
        intTxnCdMap.put("09800", "手工调账");
        /** 错账短款调账 */
        intTxnCdMap.put("09801", "错账短款调账");
        /** 冻结余额 */
        intTxnCdMap.put("09802", "冻结可用余额");
        /** 解冻余额 */
        intTxnCdMap.put("09803", "解冻可用余额");

        /** 银行卡重复支付冲正 */
        intTxnCdMap.put("09900", "银行卡重复支付冲正");
        /** 信用卡充值冲正 */
        intTxnCdMap.put("09901", "信用卡充值冲正");
        /** 海外购物交易超时冲正 */
        intTxnCdMap.put("09902", "海外购物交易超时冲正");
        /** 结算收益金 */
        intTxnCdMap.put("09700", "结算收益金");

        /** 专属账户充值 */
        intTxnCdMap.put("01300", "专属账户充值");
        /** 专属账户提现至国付宝 */
        intTxnCdMap.put("01311", "专属账户提现至国付宝");
        /** 专属账户提现 */
        intTxnCdMap.put("01301", "专属账户提现");
        /** G商融通转账 */
        intTxnCdMap.put("01302", "G商融通转账");
        /** 投标完成 */
        intTxnCdMap.put("01303", "投标完成");
        /** G商融通绑定 */
        intTxnCdMap.put("01304", "G商融通绑定");

        /** 个人扫商户 */
        intTxnCdMap.put("01601", "个人扫商户");
        /** 返润 */
        intTxnCdMap.put("01602", "商户扫个人");
        /** 手机转账到国付宝 */
        intTxnCdMap.put("01603", "手机转账到国付宝");
        /** 商户扫商户 */
        intTxnCdMap.put("01604", "商户扫商户 ");
        /** 手机转账到银行卡 */
        intTxnCdMap.put("01605", "手机转账到银行卡");
        /** 信用卡还款 */
        intTxnCdMap.put("01606", "信用卡还款");
        /** 我要收款 */
        intTxnCdMap.put("01607", "我要收款");
        /** 发红包 */
        intTxnCdMap.put("01608", "发红包");
        /** 领红包 */
        intTxnCdMap.put("01609", "领红包");
        /** 红包退款 */
        intTxnCdMap.put("01610", "红包退款");
        /** 手机钱包 话费充值 */
        intTxnCdMap.put("01611", "手机钱包话费充值");
        /** 手机钱包 流量充值 */
        intTxnCdMap.put("01612", "手机钱包流量充值");
        /** 加油卡充值 */
        intTxnCdMap.put("01613", "加油卡充值");
        /** 一分钱快捷支付*/
        intTxnCdMap.put("01614", "一分钱快捷支付（绑卡鉴权）");
        /** 理财支付*/
        intTxnCdMap.put("01615", "理财支付");
        
        /** 国付宝钱包天溢盈理财赎回 **/
        intTxnCdMap.put("01616", "理财兑付到国付宝");
        intTxnCdMap.put("01617", "理财兑付到银行");
        /** 手机钱包视频会员卡充值 add by zhoupeng 20170619*/
        intTxnCdMap.put("01618", "手机钱包视频会员");
        /** 申请数字证书 */
        intTxnCdMap.put("00601", "申请数字证书");
        /** 更新数字证书 */
        intTxnCdMap.put("00602", "更新数字证书");
        intTxnCdMap.put("00603", "银行卡鉴权");
        /** 实名认证API */
        intTxnCdMap.put("00604", "实名认证");
        /** 企业购买数字证书退款 */
        intTxnCdMap.put("00605", "数字证书退款");
        /** 收款分账 **/
        intTxnCdMap.put("00606", "收款分账");
        /** 个人 */
        custTypeMap.put("1", "个人");
        /** 企业 */
        custTypeMap.put("2", "企业");

        /** 云账户冻结 */
        intTxnCdMap.put("01807", "冻结");
        /** 云账户解冻 */
        intTxnCdMap.put("01808", "解冻");
        /** 云账户转账冻结 */
        intTxnCdMap.put("01809", "转账冻结");
        /**云账户转账*/
        intTxnCdMap.put("01810", "转账（解冻转账退款）");
        /**云账户解冻转账*/
        intTxnCdMap.put("01811", "解冻转账");
        /** G商融通(p2p)  投标 **/
        intTxnCdMap.put("01902", "G商融通投标");
        /** G商融通(p2p)  流标  **/
        intTxnCdMap.put("01903", "G商融通流标");
        /** G商融通(p2p)  放款  **/
        intTxnCdMap.put("01904", "G商融通放款");
        /** G商融通(p2p)  还款  **/
        intTxnCdMap.put("01905", "G商融通还款");
        /** G商融通(p2p)  回款  **/
        intTxnCdMap.put("01906", "G商融通回款");
        intTxnCdMap.put("01812", "云账户转账");
        /**商财通--企业理财*/
		intTxnCdMap.put("02013", "理财转入");
		intTxnCdMap.put("02014", "理财转出");
		intTxnCdMap.put("02015", "理财退款");

        /**基金支付的国付宝转基金交易*/
        intTxnCdMap.put("02016", "国付宝转基金");
        intTxnCdMap.put("02004", "基金申购/认购");
        intTxnCdMap.put("02012", "基金赎回/分红/退款");
        intTxnCdMap.put("02018", "基金转国付宝");
        /**
         * 活期宝相关
         */
        intTxnCdMap.put("02019", "活期宝转入");
        intTxnCdMap.put("02020", "活期宝转出");
        intTxnCdMap.put("02021", "活期宝退款");

        intTxnCdMap.put("02100", "手续费计提");



        /** 跨境人民币支付（出口） */
        intTxnCdMap.put("01721", "跨境人民币支付（出口）");
        /** 跨境人民币进口 **/
        intTxnCdMap.put("01720", "跨境人民币支付（进口）");
        /** 跨境人民币结汇到账户 **/
        intTxnCdMap.put("01722", "跨境人民币结汇到账户");
        /** 跨境人民币留学汇款 **/
        intTxnCdMap.put("01723", "跨境人民币留学汇款");
        /** 跨境人民币跨境汇款 **/
        intTxnCdMap.put("01724", "跨境人民币跨境汇款");
        /** 跨境汇款-线下付款 **/
        intTxnCdMap.put("01725", "跨境汇款-线下付款");
        /** 跨境人民币境外提现 **/
        intTxnCdMap.put("01726", "提现到境外");
        /** 跨境人民币进口退款 **/
        intTxnCdMap.put("01727", "跨境人民币进口退款");
        /** 跨境人民币汇款退款 **/
        intTxnCdMap.put("01728", "跨境人民币汇款退款");
        /** 跨境人民币提现退款 **/
        intTxnCdMap.put("01729", "提现到境外退款");
        /** 跨境人民币留学退款 **/
        intTxnCdMap.put("01730", "跨境人民币留学退款");
        /** 委托代收银行卡鉴权**/
        intTxnCdMap.put("00664","委托代收授权");
        /** 委托代收API **/
        intTxnCdMap.put("00666", "委托代收");
        /** 跨境人民币汇款充值 **/
        intTxnCdMap.put("01732", "跨境人民币汇款充值");
        /** 跨境人民币汇款充值退款 **/
        intTxnCdMap.put("01733", "跨境人民币汇款充值退款");
        /** 跨境人民币拨款 **/
        intTxnCdMap.put("01734", "跨境人民币拨款");

        /**
         * 存管资金结算
         */
        intTxnCdMap.put("02200", "存管资金结算");

        /**
         * 保证金
         */
        /** 上缴保证金 **/
        intTxnCdMap.put("00501", "上缴保证金");
        /** 返还保证金 **/
        intTxnCdMap.put("00502", "返还保证金");

        /**
         * 内部交易 分润到国付宝
         */
        intTxnCdMap.put("00702", "分润到国付宝");
        /**
         * 内部交易 分润到银行
         */
        intTxnCdMap.put("00703","分润到银行");
        /**
         * 内部交易 强制扣款
         */
        intTxnCdMap.put("00704","强制扣款");
        /**
         * 内部交易 返点
         */
        intTxnCdMap.put("00705", "返点");
        /**
         * 聚合支付
         */
        intTxnCdMap.put("02301", "聚合支付");
        /**
         * 三方条码支付撤销
         */
        intTxnCdMap.put("02302", "三方条码支付撤销");

    }

    /**
     * 翻译账户状态
     *
     * @param code
     * @return
     */
    public static String getAcctStatusName(AcctStatus code) {
        String statusName = "未知";
        switch (code) {
            case A:
                statusName = "正常";
                break;
            case F:
                statusName = "冻结";
                break;
            case D:
                statusName = "休眠";
                break;
            case C:
                statusName = "注销";
                break;

            default:
                break;
        }
        return statusName;
    }

    /**
     * 翻译账户状态
     *
     * @param code
     * @return
     */
    public static String getAcctStatusName(String code) {
        String statusName = "未知";
        if (null != code && !"".equals(code)) {
            String codeChange = code.trim();
            if ("A".equals(codeChange)) {
                statusName = "正常";
            } else if ("F".equals(codeChange)) {
                statusName = "冻结";
            } else if ("D".equals(codeChange)) {
                statusName = "休眠";
            } else if ("C".equals(codeChange)) {
                statusName = "注销";
            } else {
            }
        }
        return statusName;
    }

    /**
     * 币种翻译
     *
     * @param code
     * @return
     */
    public static String getCurTypeName(CurrencyCode code) {
        String typeName = "未知";
        switch (code) {
            case CNY:
                typeName = "人民币";
                break;
            case HKD:
                typeName = "港元";
                break;
            case USD:
                typeName = "美元";
                break;
            case EURO:
                typeName = "欧元";
                break;
            case JPY:
                typeName = "日元";
                break;
            case AUD:
                typeName = "澳洲元";
                break;

            default:
                break;
        }
        return typeName;
    }

    /**
     * 币种翻译
     *
     * @param code
     * @return
     */
    public static String getCurTypeName(String code) {
        String typeName = "未知";

        if (StringUtils.isNumeric(code)) {
            if (StringUtils.equals(code, CurrencyCode.CNY.value)) {
                typeName = "人民币";
            } else if (StringUtils.equals(code, CurrencyCode.HKD.value)) {
                typeName = "港元";
            } else if (StringUtils.equals(code, CurrencyCode.USD.value)) {
                typeName = "美元";
            } else if (StringUtils.equals(code, CurrencyCode.EURO.value)) {
                typeName = "欧元";
            } else if (StringUtils.equals(code, CurrencyCode.JPY.value)) {
                typeName = "日元";
            } else if (StringUtils.equals(code, CurrencyCode.AUD.value)) {
                typeName = "澳洲元";
            }
        } else {
            if (StringUtils.equals(code, CurrencyCode.CNY.name())) {
                typeName = "人民币";
            } else if (StringUtils.equals(code, CurrencyCode.HKD.name())) {
                typeName = "港元";
            } else if (StringUtils.equals(code, CurrencyCode.USD.name())) {
                typeName = "美元";
            } else if (StringUtils.equals(code, CurrencyCode.EURO.name())) {
                typeName = "欧元";
            } else if (StringUtils.equals(code, CurrencyCode.JPY.name())) {
                typeName = "日元";
            } else if (StringUtils.equals(code, CurrencyCode.AUD.name())) {
                typeName = "澳洲元";
            }
        }
        return typeName;
    }

    /**
     * 订单交易状态
     *
     * @param code
     * @return
     */
    public static String getTxnStaCdName(int code) {
        String typeName = "";
        if (code == TxnStaCode.TXN_STA_CD_30000.value) {
            typeName = "进行中";
        } else if (code == TxnStaCode.TXN_STA_CD_20000.value) {
            typeName = "成功";
        } else if (code == TxnStaCode.TXN_STA_CD_30101.value) {
            typeName = "出款清算单位处理中";
        } else if (code == TxnStaCode.TXN_STA_CD_30102.value) {
            typeName = "出款清算单位成功";
        } else if (code == TxnStaCode.TXN_STA_CD_90000.value) {
            typeName = "系统异常处理失败";
        } else if (code == TxnStaCode.TXN_STA_CD_90001.value) {
            typeName = "超时";
        } else if (code == TxnStaCode.TXN_STA_CD_90201.value) {
            typeName = "账务处理失败";
        } else if (code == TxnStaCode.TXN_STA_CD_20001.value) {
            typeName = "作废";
        } else if (code == TxnStaCode.TXN_STA_CD_20003.value) {
            typeName = "失败";
        } else if (code == TxnStaCode.TXN_STA_CD_90101.value) {
            typeName = "出款清算单位失败";
        } else if (code == TxnStaCode.TXN_STA_CD_20002.value) {
            typeName = "失效";
        }
        return typeName;
    }

    /**
     * 翻译内部交易吗
     *
     * @param intTxnCd
     *            内部交易码
     */
    public static String getIntTxnCdStr(String intTxnCd) {
        String ret = intTxnCdMap.get(intTxnCd);
        return StringUtils.isNotBlank(ret) ? ret : "未知交易";
    }

    /**
     * 翻译交易状态(只分 成功失败进行中 三种)
     * <b>该方法已废弃 建议使用 TxnStaCode.getCategory 作为替换 lx 2018-2-24 15:17:21 </b>
     * @param txnStaCd
     * @return
     */
    @Deprecated
    public static String translateTranStatus(int txnStaCd) {
        if (txnStaCd == TxnStaCode.TXN_STA_CD_20000.value) {
            return "成功";
        }  else if (txnStaCd==TxnStaCode.TXN_STA_CD_90000.value ||
                txnStaCd==TxnStaCode.TXN_STA_CD_90001.value ||
                txnStaCd==TxnStaCode.TXN_STA_CD_90003.value ||
                txnStaCd==TxnStaCode.TXN_STA_CD_90101.value ||
                txnStaCd==TxnStaCode.TXN_STA_CD_90201.value) { //生产三期：订单状态翻译 add by zhaojt
            return "进行中";
        } else if (txnStaCd >= 30000 && txnStaCd < 40000) {
            return "进行中";
        } else {
            return "失败";
        }
    }


    /**
     * 获取付款通道名称
     *
     * @param payChanel
     *            付款通道类型
     * @return
     */
    public static String getPayChannelName(String payChanel) {

        return PayChannel.translate(payChanel);

//		String channelName = "未知";
//		if (StringUtils.isBlank(payChanel))
//			return channelName;
//		if (PayChannel._00.value.equals(payChanel)) {
//			channelName = "本订单不涉及付款";
//		} else if (PayChannel._01.value.equals(payChanel)) {
//			channelName = "个人网银付款";
//		} else if (PayChannel._02.value.equals(payChanel)) {
//			channelName = "个人虚拟账户付款";
//		} else if (PayChannel._03.value.equals(payChanel)) {
////			channelName = "个人银行卡快捷付款";--快捷二期20150526wanggang
//		    channelName = "个人借记卡快捷支付付款";
//		} else if (PayChannel._04.value.equals(payChanel)) {
//			channelName = "个人信用卡无卡付款";
//		} else if (PayChannel._06.value.equals(payChanel)) {
////			channelName = "个人信用卡快捷付款";--快捷二期20150526wanggang
//		    channelName = "个人信用卡快捷支付付款";
//		} else if (PayChannel._08.value.equals(payChanel)) {
//		    channelName = "个人WAP网银付款";
//		} else if (PayChannel._49.value.equals(payChanel)) {
//			channelName = "个人银行汇款";
//		} else if (PayChannel._50.value.equals(payChanel)) {
//			channelName = "个人现金付款";
//		} else if (PayChannel._51.value.equals(payChanel)) {
//			channelName = "企业网银付款";
//		} else if (PayChannel._52.value.equals(payChanel)) {
//			channelName = "企业虚拟账户付款";
//		} else if (PayChannel._98.value.equals(payChanel)) {
//			channelName = "企业银行汇款";
//		} else if (PayChannel._99.value.equals(payChanel)) {
//			channelName = "企业现金付款";
//		}
//		// update by dongdh 20160613  快捷代扣api 加入3种支付方式
//		else if (PayChannel._30.value.equals(payChanel)) {
//		    channelName = "个人信用卡快捷支付付款(API)";
//		} else if (PayChannel._31.value.equals(payChanel)) {
//		    channelName = "个人借记卡快捷支付付款(API)";
//		} else if (PayChannel._32.value.equals(payChanel)) {
//		    channelName = "个人代扣支付付款(API)";
//		}
//		//edit by zhoutong 20160811 加入三方扫码支付、三方APP支付
//        else if (PayChannel._16.value.equals(payChanel)) {
//            channelName = "三方扫码支付";
//        } else if (PayChannel._17.value.equals(payChanel)) {
//            channelName = "三方APP支付";
//        }
//		//add by dhj 20161010 微信线下扫码支付API start-------------
//        else if (PayChannel._18.value.equals(payChanel)) {
//        	channelName = "三方线下扫码支付(API)";
//        }
//		//add by dhj 20161010 微信线下扫码支付API end---------------
//		return channelName;
    }



    /**
     * 翻译对公对私
     */
    public static String getBCFlag(String bcode) {
        String bcflag = "不区分";
        if (bcode.equals(BCFlag.BC_FLAG_C.value)) {
            bcflag = "对公";
        } else if (bcode.equals(BCFlag.BC_FLAG_P.value)) {
            bcflag = "对私";
        }
        return bcflag;
    }

    /**
     * 翻译审核是否通过
     */
    public static String getAuditResult(int flag) {
        String re = "未知";
        if (flag == DecisionValue.AGREE.value) {
            re = "审核通过";
        } else if (flag == DecisionValue.REJECT.value) {
            re = "审核拒绝";
        }
        return re;
    }

    /**
     * 翻译付款渠道，，只有线上，线下之分
     */
    public static String getPayChannel(String paychanels) {
        String payChannelName = "未知";

        if (PayChannel._00.value.equals(paychanels) || PayChannel._01.value.equals(paychanels) || PayChannel._02.value.equals(paychanels)
                || PayChannel._03.value.equals(paychanels) || PayChannel._04.value.equals(paychanels) || PayChannel._06.value.equals(paychanels)
                || PayChannel._08.value.equals(paychanels) || PayChannel._49.value.equals(paychanels) || PayChannel._50.value.equals(paychanels)
                || PayChannel._30.value.equals(paychanels) || PayChannel._31.value.equals(paychanels) || PayChannel._32.value.equals(paychanels)
                || PayChannel._51.value.equals(paychanels) || PayChannel._52.value.equals(paychanels)
                //加入三方扫码支付和三方APP支付 zhoutong edit at 20160811
                || PayChannel._16.value.equals(paychanels) || PayChannel._17.value.equals(paychanels)|| PayChannel._18.value.equals(paychanels)|| PayChannel._25.value.equals(paychanels)) {

            payChannelName = "线上";
        } else if (PayChannel._98.value.equals(paychanels) || PayChannel._99.value.equals(paychanels)) {
            payChannelName = "线下";
        }

        return payChannelName;

    }

    /**
     * 获取客户级别
     */
    public static String getCustLevel(String PRIVILEGE) {
        String custLevel = "未知";
        if (StringUtils.isBlank(PRIVILEGE)){
            return custLevel;
        }
        if (PRIVILEGE.equals("0")) {
            custLevel = "普通";
        } else if (PRIVILEGE.equals("1")) {
            custLevel = "优质";
        }
        return custLevel;
    }

    /**
     * 订单来源
     *
     * @param code
     * @return
     */
    public static String getOrderOri(GatewaySource code) {
        String typeName = "未知";
        switch (code) {
            case GATEWAY_SOURCE_00:
                typeName = "未经网关";
                break;
            case GATEWAY_SOURCE_01:
                typeName = "互联网网关";
                break;
            case GATEWAY_SOURCE_02:
                typeName = "移动网关";
                break;
            case GATEWAY_SOURCE_03:
                typeName = "大宗网关";
                break;
            case GATEWAY_SOURCE_04:
                typeName = "P2P网关";
                //zhoutong edit at 20160811 加入三方扫码网关、三方APP网关
                break;
            case GATEWAY_SOURCE_13:
                typeName = "三方APP网关";
                break;
            case GATEWAY_SOURCE_14:
                typeName = "三方扫码网关";
                break;
            case GATEWAY_SOURCE_15:
                typeName = "微信公众号网关";
                break;
            case GATEWAY_SOURCE_18:
                typeName = "三方条码支付网关";
                break;
            case GATEWAY_SOURCE_21:
                typeName = "POS终端网关";
                break;
        }
        return typeName;




    }


    /**
     * 订单来源
     *
     * @param code
     * @return
     */

    public static String  getOrderOri(String code) {
        String typeName = "未知";
        if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_00.value)) {
            typeName = "未经网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_01.value)) {
            typeName = "互联网网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_02.value)) {
            typeName = "移动网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_03.value)) {
            typeName = "大宗网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_04.value)) {
            typeName = "P2P网关";
        }
        //zhoutong edit at 20160811 加入三方
        else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_13.value)) {
            typeName = "三方APP网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_14.value)) {
            typeName = "三方扫码网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_15.value)) {
            typeName = "微信公众号网关";
        }else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_18.value)) {
            typeName = "三方条码支付网关";
        } else if (StringUtils.equals(code, GatewaySource.GATEWAY_SOURCE_21.value)) {
            typeName = "POS终端网关";
        }
        else{}
        return typeName;
    }

    /**
     * 客户状态字典
     *
     * @param custStat
     * @param custType
     *            客户类型：企业，个人
     * @return
     */
    public static String getCustStat(String custStat, String custType) {
        String typeName = "未知";
        if (null != custType && !"".equals(custType)) {
            if ("2".equals(custType)) {// 企业
                if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_NORMAL)) {
                    typeName = "正常";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_CANCEL)) {
                    typeName = "注销";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_WAIT_EMAIL_CERTIFY)) {
                    typeName = "待邮箱验证";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_CONSOLE_LOCK)) {
                    typeName = "控制台锁定";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_WAIT_INFO_PERFECT)) {
                    typeName = "待补全客户信息";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_AUDIT_REFUSED)) {
                    typeName = "审核不通过";
                } else if (StringUtils.equals(custStat, CustCorpInfoConstants.CORP_STAT_WAIT_AUDIT)) {
                    typeName = "待审核";
                }
            }
            if ("1".equals(custType)) {// 个人
                if (StringUtils.equals(custStat, CustPersonInfoConstants.CUST_STAT_NORMAL)) {
                    typeName = "正常";
                } else if (StringUtils.equals(custStat, CustPersonInfoConstants.CUST_STAT_WAIT_EMAIL_CERTIFY)) {
                    typeName = "待邮箱验证";
                } else if (StringUtils.equals(custStat, CustPersonInfoConstants.CUST_STAT_WAIT_INFO_PERFECT)) {
                    typeName = "待补全客户信息";
                } else if (StringUtils.equals(custStat, CustPersonInfoConstants.CUST_STAT_CANCEL)) {
                    typeName = "注销";
                } else if (StringUtils.equals(custStat, CustPersonInfoConstants.CUST_STAT_CONSOLE_LOCKED)) {
                    typeName = "控制台锁定";
                }
            }
        }
        return typeName;
    }

    /**
     * 翻译账户产品
     *
     * @param ap
     * @return
     */
    public static String getAcctProd(AcctProd ap) {
        String typeName = "";
        switch (ap) {
            case GNST:
                typeName = "普通账户";
                break;
            case INTR:
                typeName = "国付宝账户";
                break;
            case BLME:
                typeName = "G商银通会员账户";
                break;
            case BLMK:
                typeName = "G商银通资金存管账户";
                break;
        /*
         * case PPEA: typeName = "G商融通专属账户"; break; case PPTA: typeName =
         * "G商融通平台账户"; break; case PPRA: typeName = "G商融通风险金账户"; break;
         */
            case CLOUD:
                //typeName = "云账户会员账户";
                typeName = "云账户总账户";
                break;
            case SUBCLOUD:
                typeName = "云账户子账户";
                break;
            case SQB:
                typeName = "生钱包专属账户";
                break;
            case GTZSZH:
                typeName = "G商融通专用账户";
                break;
            case GTDBFZH:
                typeName = "G商融通担保方账户";
                break;
            case GTPTZH:
                typeName = "G商融通平台账户";
                break;
            case GTFXJZH:
                typeName = "G商融通风险金账户";
                break;
            case GTTZZH:
                typeName = "G商融通投资账户";
                break;
            case GTHZZH:
                typeName = "G商融通还款账户";
                break;
            case DFSA:
                typeName = "资金结算账户";
                break;
            case DEPO:
                typeName = "保证金账户";
                break;
            case FDSR :
                typeName = "基金申购认购账户";
                break;
            case FDSFT :
                typeName = "赎回分红退款账户";
                break;
            case KJRMBZH :
                typeName = "跨境人民币专属账户";
                break;
            default:
                break;
        }
        return typeName;
    }

    /**
     * 翻译账户产品
     *
     * @param code
     * @return
     */
    public static String getAcctProd(String code) {
        String typeName = "";
        if (null != code && !"".equals(code)) {

            String codeChange = code.trim();
            if ("GNST".equals(codeChange)) {
                typeName = "普通账户";
            } else if ("INTR".equals(codeChange)) {
                typeName = "国付宝账户";
            } else if ("BLME".equals(codeChange)) {
                typeName = "G商银通会员账户";
            } else if ("BLMK".equals(codeChange)) {
                typeName = "G商银通资金存管账户";
            } else if ("CLOUD".equals(codeChange)) {
                //add by jiaoshuai 20161122 增加云账户子账户，将“云账户会员账户”修改为“云账户总账户”
                //typeName = "云账户会员账户";
                typeName = "云账户总账户";
            } else if("SUBCLOUD".equals(codeChange)) {
                typeName = "云账户子账户";
            } else if ("SQB".equals(codeChange)) {
                typeName = "生钱包专属账户";
            } else if ("GTZSZH".equals(codeChange)) {
                typeName = "G商融通专用账户";
            } else if ("GTDBFZH".equals(codeChange)) {
                typeName = "G商融通担保方账户";
            } else if ("GTPTZH".equals(codeChange)) {
                typeName = "G商融通平台账户";
            } else if ("GTFXJZH".equals(codeChange)) {
                typeName = "G商融通风险金账户";
            } else if ("GTTZZH".equals(codeChange)) {
                typeName = "G商融通投资账户 ";
            } else if ("GTHZZH".equals(codeChange)) {
                typeName = "G商融通还款账户";
            } else if ("FDSR".equals(codeChange)) {
                typeName = "基金申购认购账户";
            } else if ("FDSFT".equals(codeChange)) {
                typeName = "赎回分红退款账户";
            } else if ("KJRMBZH".equals(codeChange)) {
                typeName = "跨境人民币专属账户";
            } else if (AcctProd.DFSA.toString().equals(codeChange) ){
                typeName = "资金结算账户";
            }  else if (AcctProd.DEPO.toString().equals(codeChange) ){
                typeName = "保证金账户";
            }else {

            }
        }

        return typeName;
    }

    /**
     * 翻译上传文件对账状态
     *
     * @param status
     * @return
     */
    public static String getAdjustResult(OrderAdjustRecordStatus status) {
        String statusName = "未知";
        switch (status) {
            case AUDIT_RESULT_SUCCESS:
                statusName = "成功";
                break;
            case AUDIT_RESULT_FAIL:
                statusName = "失败";
                break;
            case AUDIT_RESULT_NONE:
                statusName = "无此订单";
                break;
            case AUDIT_RESULT_NOLAUNCH:
                statusName = "未发起";
                break;
            case AUDIT_RESULT_NODEAL:
                statusName = "未处理";
                break;
        }
        return statusName;
    }

    /**
     * 翻译上传文件对账状态
     *
     * @param status
     * @return
     */
    public static String getAdjustResult(String status) {
        String statusName = "未知";
        if (StringUtils.equals(status, OrderAdjustRecordStatus.AUDIT_RESULT_SUCCESS.value)) {
            statusName = "成功";
        } else if (StringUtils.equals(status, OrderAdjustRecordStatus.AUDIT_RESULT_FAIL.value)) {
            statusName = "失败";
        } else if (StringUtils.equals(status, OrderAdjustRecordStatus.AUDIT_RESULT_NONE.value)) {
            statusName = "无此订单";
        } else if (StringUtils.equals(status, OrderAdjustRecordStatus.AUDIT_RESULT_NOLAUNCH.value)) {
            statusName = "未发起";
        } else if (StringUtils.equals(status, OrderAdjustRecordStatus.AUDIT_RESULT_NODEAL.value)) {
            statusName = "未处理";
        }
        return statusName;
    }

    public static String getManualAdjustTypeName(String type) {
        if (StringUtils.equals(type, ManualAdjustType.CUST_ADJUST.value)) {
            return "客户账";
        } else if (StringUtils.equals(type, ManualAdjustType.IN_ADJUST.value)) {
            return "内部调账";
        } else if (StringUtils.equals(type, ManualAdjustType.TRANS_ADJUST.value)) {
            return "处理交易错账";
        }
        return "";
    }

    // 0-待结算,1-全部结算,2-部分结算,3-未结算
    public static String getAutoSettleStatus(String settleSta) {
        if (StringUtils.equals("0", settleSta)) {
            return "待结算";
        }
        if (StringUtils.equals("1", settleSta)) {
            return "全部结算";
        }
        if (StringUtils.equals("2", settleSta)) {
            return "部分结算";
        }
        if (StringUtils.equals("3", settleSta)) {
            return "未结算";
        }
        return "";
    }

    /**
     * 状态（01：启用, 02：关闭,03：过期）
     *
     * @param statCode
     * @return
     */
    public static String getCustCaCertStatus(String statCode) {
        if (StringUtils.equals("01", statCode)) {
            return "启用";
        }
        if (StringUtils.equals("02", statCode)) {
            return "关闭";
        }
        if (StringUtils.equals("03", statCode)) {
            return "过期";
        }
        return "";
    }

    /**
     * 获取用户类型
     */
    public static String getCustType(String custType) {
        String ret = custTypeMap.get(custType);
        return isNotBlank(ret) ? ret : "未知";
    }




    public static boolean isNotBlank(String s) {
        if (null != s) {
            return true;
        }
        return false;
    }

    private static final Map<String, String> ALLOCATION_PAYMENT_STATUS_MAP = new HashMap<>(6);
    private static final Map<String, String> PAYMENT_STATUS_MAP = new HashMap<>();
    static {
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.INIT.value, "-");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.OFFER_READY.value, "-");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.OFFER_ONGOING.value, "付款进行中");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.OFFER_SUCCESS.value, "付款进行中");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.OFFER_FAIL.value, "付款进行中");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.PAY_SUCCESS.value, "付款成功");
        PAYMENT_STATUS_MAP.put(CbRmbOrderState.PAY_FAIL.value, "付款失败");

        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._01.value, "-");
        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._02.value, "拨款进行中");
        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._04.value, "拨款成功");
        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._05.value, "拨款失败");
        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._06.value, "拨款锁定");
        ALLOCATION_PAYMENT_STATUS_MAP.put(PayStat._07.value, "拨款申请已受理");
    }
    public static String getPaymentStatusName(String paymentStatusCode) {
        if (PAYMENT_STATUS_MAP.containsKey(paymentStatusCode)) {
            return PAYMENT_STATUS_MAP.get(paymentStatusCode);
        } else {
            return "-";
        }
    }

    public static String transAllocationPaymentStatus(String payStateCode) {
        String result = ALLOCATION_PAYMENT_STATUS_MAP.get(payStateCode);
        if (result == null) {
            return "-";
        }
        return result;
    }

    public static String getPayBankName(String shortName) {
        if ("CMBC".equals(shortName)) {
            return "中国民生银行";
        } else if ("ICBC".equals(shortName)) {
            return "中国工商银行";
        } else if ("PAB".equals(shortName)) {
            return "平安银行";
        } else if ("ABC".equals(shortName)) {
            return "中国农业银行";
        } else if ("CMB".equals(shortName)) {
            return "招商银行";
        } else if ("BOC".equals(shortName)){
            return "中国银行";
        } else if ("CCB".equals(shortName)){
            return "中国建设银行";
        }
        return shortName;

    }
}
